<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

use think\Db;
// 应用公共文件

//    根据用户id查出用户名字
if(!function_exists('getUserName'))
{
    function getUserName($id)
    {
        return Db::name('user')->where('id',$id)->value('name');
    }

}

//    获取文章前10个字符作为摘要
if(!function_exists('getArtAbstract'))
{
    function getArtAbstract($content)
    {
        return mb_substr(strip_tags($content),0,10)."。。。";
    }
}

//查询对应文章分类名称
if(!function_exists('getCateName'))
{
    function getCateName($id)
    {
        return Db::name('artcate')->where('id',$id)->value('name');
    }
}


